<!-- 
@name: 积分明细
-->
<template>
	<div id="BankingBusinessList" class="page">
		<div class="top">
			<div class="title">{{$store.state.userinfo.points}}</div>
			<!-- <div class="block">
				<span style="color: #D95954;">392 </span>积分将于 2021.10.01 到期
			</div> -->
		</div>
		<div class="content-wrap">
			<div class="diy-area">
				<div class="like">
					<div class="scorllWrap" ref='type2Scorll' id='type2Scorll'>
						<van-list v-model="loading" offset='0' :finished="finished" finished-text="没有更多了" @load="onLoad">
							<div class="item" style="flex:1" v-for="(item,index) in dataList" :key="index">
								<div class="flex-between" style="margin-bottom:0.2rem">
									<div class="flex-row">
										<div class="text1">{{item.jtypeName}}<b v-if="item.jtype=='UNLINE'&&item.vendorName"> ({{item.vendorName}})</b></div>
										<div class="text5" v-if="item.jtype =='REFUND'">退款</div>
									</div>
									<div class="flex-column">
									<div v-if="item.point<0" :class="'text2'">{{item.point}}积分</div>
									<div v-if="item.point>0" :class="'text3'">+{{item.point}}积分</div>
									<div v-if="item.jtype=='UNLINE'&&item.pointAmt" :class="'text3'" style="font-size: 0.24rem;">(抵扣{{item.pointAmt}}元)</div>

									</div>
								</div>
								<div class="flex-between" style="margin-bottom:0.2rem">
									<div class="text4">{{item.createdTime}}</div>
									<div class="text4">{{item.summary}}</div>

								</div>
							</div>
						</van-list>

					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
export default {
	name: 'app',
	components: {},
	data() {
		return {
			searchValue: '',
			searchTypeIndex: '',
			getGtypeList: [],
			listModel: true, //true 列表模式 false 大图模式
			searchTypeList: [
				{ value: '销量最高', pkey: 'XS' },
				{ value: '距离最近', pkey: 'NEAR' },
				{ value: '评分最高', pkey: 'RATE' },
			],
			rateIcon:
				'https://filetest.xinanshizu.com/file/v2/image?file=4235.png&code=00D96F02428C3AD8E53A3A6724AEC38C',
			rateIcon2:
				'https://filetest.xinanshizu.com/file/v2/image?file=4236.png&code=C993979E415E6C8ED7784EFD6C0AEAFE',

			searchData: {
				page: 0,
				pagesize: 5,
			},
			dataList: [
				// {
				// 	point: 1000,
				// 	createdTime: '2021.01.01 12:01:00',
				// 	jtype: 'CONSUME', //CONSUME 消费 ，REFUND 退款, DIVIDE 分销, BNK 银行
				// },
				// {
				// 	point: -1000,
				// 	createdTime: '2021.01.01 12:01:00',
				// 	jtype: 'REFUND', //CONSUME 消费 , REFUND 退款, DIVIDE 分销, BNK 银行
				// },
			],
			activeName: '',
			loading: false,
			finished: false,
		};
	},

	created() {},
	methods: {
		goDetail(item) {
			// console.log()
			this.$router.push({
				path: '/BankingBusiness/share',
				query: { item: JSON.stringify(item) },
			});
		},
		sortChange(pkey) {
			this.searchData.sortType = pkey;
			this.clearSearch();
			this.finished = true;
			this.getData(true);
		},
		onLoad() {
			console.log('触底');
			this.getData();
		},
		onClick() {
			this.clearSearch();
			this.finished = true;
			this.getData(true);
		},
		getGtype_goods() {
			this.$myApi.getGtype_goods().then((res) => {
				if (res.code == 0) {
					var arr = [{ name: '全部', pkey: '' }, ...res.result];
					this.getGtypeList = arr;
				} else {
				}
			});
		},
		getData(finished) {
			// finished 避免清空列表出发刷新
			var params = this.searchData;
			this.$myApi.loadPointLine_centre(params).then((res) => {
				if (res.code == 0) {
					this.dataList = [...this.dataList, ...res.result.content];
					this.loading = false;
					this.searchData.page++;
					if (finished) {
						this.finished = false;
					}
					if (res.result.content.length < 5) {
						this.finished = true;
					}
				} else {
				}
			});
		},
		clearSearch() {
			this.dataList = [];
			this.searchData.page = 0;
			this.searchData.pagesize = 5;
			this.finished = false;
		},
		onSearch(e) {
			console.log(e);
			this.clearSearch();
			this.searchData.title = e;
			this.finished = true;
			this.getData(true);
		},
		onCancel() {},
	},
};
</script>
<style lang="less" scoped>
#BankingBusinessList {
	padding-left: 0rem;
	padding-right: 0rem;
	min-height: 100vh;
	background-color: #fafafa;

	padding-bottom: 0;

	.top {
		margin: 0.25rem;
		.title {
			font-size: 0.72rem;
			font-weight: bold;
			color: #000000;
		}
		.block {
			background: #eeeeee;
			border-radius: 20px;
			padding: 0.2rem;
			display: inline-block;
			margin: 0.2rem 0;
		}
	}
	.content-wrap {
		width: 100%;
		height: auto;
		.diy-area {
			// background-color: #fff;
			position: relative;
			background-color: inherit;

			img {
				vertical-align: top;
			}

			.banner {
				.bannerImg {
					height: 4rem;
					width: 100%;
				}
			}
			.br {
				height: 0.2rem;
				width: 100%;
				background: #fafafa;
			}
			.likeTitle {
				font-size: 0.32rem;
				font-family: PingFang SC;
				font-weight: bold;
				color: #000000;
				margin-bottom: 0.24rem;
				text-align: center;
			}
			.like {
				margin: 0.25rem;
				background: #fff;
				height: calc(100vh - 46px - 0.5rem);
				position: relative;
				box-sizing: border-box;
				border-radius: 10px;

				.scorllWrap {
					width: 100%;
					overflow-x: scroll;
					height: 100%;
					padding-bottom: 1rem;
					.item {
						padding: 0.3rem;
						border-bottom: 1px solid #ededed;
						width: 100%;
						.text1 {
							font-size: 0.3rem;
							color: #333333;
						}
						.text2 {
							font-size: 0.3rem;
							font-weight: bold;
							color: #333333;
						}
						.text3 {
							font-size: 0.3rem;
							font-weight: bold;
							color: #d95954;
						}
						.text4 {
							font-size: 0.24rem;
							color: #999999;
						}
						.text5 {
							background: #f5f5f5;
							padding: 0.1rem;
							font-size: 0.24rem;
							color: #666666;
							border-radius: 5px;
							margin-left: 0.2rem;
						}
					}
				}
			}
			.iconWrap {
				position: relative;
				padding-bottom: 0.55rem;
				border-radius: 20px 20px 0 0;
				top: -0.3rem;
				// margin-top: -0.4rem;
				background-color: #fafafa;
				z-index: 999;
				display: grid;
				grid-template-columns: repeat(4, 25%);
				.iconImg {
					width: 0.8rem;
					height: 0.8rem;
					margin-bottom: 0.12rem;
				}
				.item {
					-webkit-box-flex: 1;
					flex: 1;
					margin-top: 0.3rem;
					font-size: 0.24rem;
					text-align: center;
				}
			}
		}
	}
}
</style>
<style lang="less" scoped>
/deep/.van-search .van-cell {
	padding-top: 0.2rem;
	padding-bottom: 0.2rem;
	font-size: 0.28rem;
}
/deep/.van-tab {
	// flex: 0 1 auto;
	// width: 1rem;
	font-size: 0.3rem;
}
/deep/.van-tab--active {
	font-weight: bold;
	font-size: 0.32rem;
}
</style>